package com.ibeetl.cms.service;

import java.util.Date;
import java.util.List;

import org.beetl.sql.core.engine.PageQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ibeetl.admin.core.util.PlatformException;

import com.ibeetl.cms.dao.DeclareLimitDao;
import com.ibeetl.cms.entity.DeclareLimit;
import com.ibeetl.admin.core.service.BaseService;

/**
 * DeclareLimit Service
 */

@Service
@Transactional
public class DeclareLimitService extends BaseService<DeclareLimit>{

    @Autowired private DeclareLimitDao declareLimitDao;

    public PageQuery<DeclareLimit>queryByCondition(PageQuery query){
        PageQuery ret =  declareLimitDao.queryByCondition(query);
        queryListAfter(ret.getList());
        return ret;
    }

    public void batchDelDeclareLimit(List<Long> ids){
        try {
            declareLimitDao.batchDelDeclareLimitByIds(ids);
        } catch (Exception e) {
            throw new PlatformException("批量删除DeclareLimit失败", e);
        }
    }

    public int isInTime(Integer type,Date time){
        return declareLimitDao.isInTime(type,time);
    }
}